﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnterProcess : MonoBehaviour
{
    PoolManage _testPool;
    public GameObject _poolObj;
    public ObjPoolTest _pt;
    public int _size;

    private void Start()
    {
        _testPool = PoolManage.CreatePool("SpherePool");
        _testPool.Init(_size,_poolObj);

        _pt._onClickBlankSpace += InsPoolObj;
        _pt._onTouchPoolObj += _testPool.RecyclePoolObj;
    }

    public void InsPoolObj()
    {
        GameObject go = _testPool.InsPoolObj();
        if (go == null) return;

        Vector3 pos = Input.mousePosition;
        pos.z = 10;
        go.transform.position = Camera.main.ScreenToWorldPoint(pos);
    }
}
